defmodule TuistWeb.Marketing.MarketingHTML do
  use TuistWeb, :html
  use Noora

  import TuistWeb.Marketing.MarketingComponents
  import TuistWeb.Marketing.MarketingOrgLogos
  import TuistWeb.Marketing.TestimonialOrgLogos

  alias Tuist.Marketing.Blog

  embed_templates("marketing_html/*")
  embed_templates("marketing_html/blog/*")

  # Delegate to Localization module
  defdelegate localized_href(href), to: TuistWeb.Marketing.Localization

  attr(:title, :string, required: true)
  attr(:primary_action_title, :string, required: false)
  attr(:primary_action_href, :string, required: false)
  attr(:primary_action_target, :string, default: "_blank")
  attr(:secondary_action_title, :string, required: false)
  attr(:secondary_action_href, :string, required: false)
  attr(:secondary_action_target, :string, default: "_blank")

  defp marketing_banner(assigns) do
    default_primary_href = localized_href("https://docs.tuist.dev/")

    assigns =
      assigns
      |> assign(
        :primary_action_title,
        Map.get(assigns, :primary_action_title, dgettext("marketing", "Get started"))
      )
      |> assign(
        :primary_action_href,
        Map.get(assigns, :primary_action_href, default_primary_href)
      )
      |> assign(
        :secondary_action_title,
        Map.get(assigns, :secondary_action_title, dgettext("marketing", "Talk to us"))
      )
      |> assign(
        :secondary_action_href,
        Map.get(
          assigns,
          :secondary_action_href,
          "https://cal.tuist.dev/team/tuist/tuist?overlayCalendar=true"
        )
      )

    ~H"""
    <div id="marketing-banner">
      <img data-part="background" src={~p"/marketing/images/components/banner/background.webp"} />
      <h2 data-part="title">{@title}</h2>
      <nav data-part="actions" aria-label="Primary actions">
        <.button
          href={@primary_action_href}
          label={@primary_action_title}
          target={@primary_action_target}
        >
        </.button>
        <.button
          href={@secondary_action_href}
          variant="secondary"
          label={@secondary_action_title}
          target={@secondary_action_target}
        >
        </.button>
      </nav>
    </div>
    """
  end

  attr(:name, :string, required: true)
  attr(:role, :string, required: true)
  attr(:photo_src, :string, required: true)
  attr(:github_handle, :string, required: true)
  attr(:mastodon_url, :string, required: true)
  attr(:bluesky_url, :string, required: false)
  attr(:linkedin_url, :string, required: false)

  defp about_team_member(assigns) do
    ~H"""
    <div data-part="member">
      <div data-part="photo">
        <img src={@photo_src} />
        <div data-part="data">
          <h3 data-part="name">
            {@name}
          </h3>
          <p data-part="role">
            {@role}
          </p>
        </div>
      </div>
      <div data-part="links">
        <.neutral_button size="large" href={"https://github.com/#{@github_handle}"} target="_blank">
          <.github_logo />
        </.neutral_button>
        <.neutral_button size="large" href={@mastodon_url} target="_blank">
          <.mastodon_logo />
        </.neutral_button>
        <.neutral_button
          :if={not is_nil(Map.get(assigns, :bluesky_url))}
          size="large"
          href={@bluesky_url}
          target="_blank"
        >
          <.bluesky_logo />
        </.neutral_button>
        <.neutral_button
          :if={not is_nil(Map.get(assigns, :linkedin_url))}
          size="large"
          href={@linkedin_url}
          target="_blank"
        >
          <.linkedin_logo />
        </.neutral_button>
      </div>
    </div>
    """
  end

  def language(assigns) do
    ~H"""
    <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path
        d="M10 18.3333C14.6024 18.3333 18.3333 14.6024 18.3333 10C18.3333 5.39763 14.6024 1.66667 10 1.66667C5.39763 1.66667 1.66667 5.39763 1.66667 10C1.66667 14.6024 5.39763 18.3333 10 18.3333Z"
        stroke="currentColor"
        stroke-width="1.5"
        stroke-linecap="round"
        stroke-linejoin="round"
      />
      <path
        d="M1.66667 10H18.3333"
        stroke="currentColor"
        stroke-width="1.5"
        stroke-linecap="round"
        stroke-linejoin="round"
      />
      <path
        d="M10 1.66667C12.0844 3.94863 13.2698 6.91003 13.3333 10C13.2698 13.09 12.0844 16.0514 10 18.3333C7.91561 16.0514 6.73021 13.09 6.66667 10C6.73021 6.91003 7.91561 3.94863 10 1.66667Z"
        stroke="currentColor"
        stroke-width="1.5"
        stroke-linecap="round"
        stroke-linejoin="round"
      />
    </svg>
    """
  end

  defp github_logo(assigns) do
    ~H"""
    <svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path
        fill-rule="evenodd"
        clip-rule="evenodd"
        d="M8.06799 2.77262C9.66932 2.41245 11.3308 2.41245 12.9321 2.77262C13.8505 2.19979 14.5733 1.92842 15.1147 1.81073C15.4156 1.74532 15.6583 1.72789 15.8441 1.73202C15.9368 1.73408 16.0144 1.74148 16.0772 1.75065C16.1086 1.75523 16.1361 1.76023 16.1598 1.76519C16.1716 1.76767 16.1825 1.77013 16.1925 1.77252L16.2066 1.77604L16.2131 1.77775L16.2163 1.77858L16.2178 1.77899C16.2186 1.7792 16.2193 1.7794 16.0001 2.58337L16.2193 1.7794C16.4597 1.84495 16.6581 2.0146 16.7602 2.24185C17.1586 3.12863 17.2453 4.11873 17.0153 5.0533C17.6496 5.86771 17.999 6.87404 18.0001 7.91586V7.91671C18.0001 10.0056 17.3793 11.4521 16.2955 12.3904C15.5665 13.0217 14.6898 13.3669 13.8122 13.5627C13.8444 13.8113 13.8399 14.0974 13.8359 14.3526C13.8346 14.4333 13.8334 14.511 13.8334 14.5834V17.5C13.8334 17.9603 13.4603 18.3334 13.0001 18.3334C12.5398 18.3334 12.1667 17.9603 12.1667 17.5V14.5834C12.1667 14.4726 12.1681 14.371 12.1694 14.2809L12.1697 14.2634C12.1709 14.1789 12.1719 14.1079 12.1719 14.0417C12.1719 13.8978 12.1665 13.8176 12.1572 13.762C12.1497 13.7168 12.1403 13.6928 12.1279 13.6699C12.1129 13.6424 12.0786 13.5905 11.9941 13.506C11.7672 13.279 11.6908 12.942 11.7976 12.6393C11.9044 12.3367 12.1755 12.1223 12.4946 12.0881C13.6058 11.9691 14.5442 11.7022 15.2046 11.1305C15.8291 10.5897 16.3332 9.66142 16.3334 7.91756C16.3326 7.13818 16.0285 6.38971 15.4856 5.8306C15.2608 5.59912 15.1898 5.25866 15.3034 4.95664C15.4855 4.47252 15.5215 3.94993 15.4135 3.45202C15.0478 3.54002 14.4316 3.76945 13.5456 4.36008C13.3479 4.4919 13.1033 4.53303 12.8734 4.47314C11.3171 4.06783 9.683 4.06783 8.12675 4.47314C7.89679 4.53303 7.65219 4.4919 7.45447 4.36008C6.56852 3.76944 5.95231 3.54002 5.58665 3.45202C5.47857 3.94993 5.51459 4.47252 5.6967 4.95664C5.8103 5.25866 5.73935 5.59912 5.51455 5.8306C4.97167 6.38962 4.66761 7.13794 4.66672 7.91718C4.66681 9.66129 5.17098 10.5897 5.79554 11.1305C6.45589 11.7022 7.39427 11.9691 8.5055 12.0881C8.8246 12.1223 9.09571 12.3367 9.20254 12.6393C9.30936 12.942 9.23291 13.279 9.00598 13.506C8.86708 13.6449 8.82685 13.7468 8.80798 13.8449C8.78263 13.9767 8.78636 14.1552 8.82695 14.48C8.83124 14.5143 8.83339 14.5488 8.83339 14.5834V15.8142C8.83369 15.8271 8.83369 15.84 8.83339 15.8528V17.5C8.83339 17.9603 8.46029 18.3334 8.00006 18.3334C7.53982 18.3334 7.16672 17.9603 7.16672 17.5V16.8805C6.62144 16.9515 6.12949 16.9213 5.68183 16.7961C4.94794 16.5908 4.4371 16.1591 4.05872 15.7239C3.82548 15.4557 3.58981 15.1131 3.40682 14.8471C3.32847 14.7332 3.25977 14.6333 3.20507 14.5594C2.96361 14.2329 2.83757 14.1542 2.76492 14.1328C2.32338 14.003 2.07072 13.5398 2.20058 13.0982C2.33045 12.6567 2.79366 12.404 3.23519 12.5339C3.87087 12.7209 4.27608 13.2047 4.54504 13.5683C4.6735 13.742 4.77488 13.891 4.86824 14.0283C5.01322 14.2414 5.13883 14.4261 5.31639 14.6303C5.56301 14.9139 5.81259 15.102 6.13078 15.191C6.36749 15.2572 6.6975 15.2839 7.16672 15.1928V14.6344C7.12783 14.3117 7.09792 13.9375 7.16615 13.5579C6.29586 13.3612 5.42756 13.0165 4.70457 12.3904C3.62085 11.4521 3.00005 10.0056 3.00005 7.91671V7.91586C3.00112 6.87403 3.35055 5.86771 3.98482 5.05329C3.7548 4.11873 3.84149 3.12863 4.23992 2.24185C4.34202 2.0146 4.54044 1.84495 4.78079 1.7794L5.00006 2.58337C4.78079 1.7794 4.78154 1.7792 4.7823 1.77899L4.78383 1.77858L4.78696 1.77775L4.7935 1.77604L4.80766 1.77252C4.81759 1.77013 4.82847 1.76767 4.84032 1.76519C4.86404 1.76023 4.89156 1.75523 4.9229 1.75065C4.98568 1.74148 5.06334 1.73408 5.15602 1.73202C5.34184 1.72789 5.58456 1.74532 5.88541 1.81073C6.42678 1.92842 7.14961 2.19979 8.06799 2.77262Z"
        fill="currentColor"
      />
    </svg>
    """
  end

  defp mastodon_logo(assigns) do
    ~H"""
    <svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path
        d="M16.3333 8.59187C16.3333 7.29711 16.3248 6.53541 16.2023 5.93725C16.1064 5.46885 15.9377 5.09382 15.5789 4.64412L15.4129 4.44636C15.1984 4.20115 14.8293 3.97692 14.311 3.79532C13.8028 3.61729 13.218 3.50316 12.6468 3.43318C12.0791 3.36364 11.5478 3.3403 11.1576 3.33471C10.9635 3.33193 10.8061 3.33328 10.6986 3.33552C10.6448 3.33665 10.6034 3.33782 10.5765 3.33878C10.5631 3.33926 10.5533 3.34015 10.5472 3.34041H10.4528C10.4468 3.34015 10.4368 3.33926 10.4235 3.33878C10.3966 3.33782 10.3552 3.33666 10.3014 3.33552C10.1938 3.33325 10.0359 3.33196 9.84163 3.33471C9.45147 3.34024 8.92069 3.36295 8.35319 3.43237C7.78186 3.50226 7.19647 3.61648 6.68815 3.79451C6.23483 3.95331 5.89625 4.14486 5.67497 4.3544L5.58708 4.44555C5.11227 4.98789 4.90736 5.40108 4.79769 5.93643C4.67576 6.53165 4.66675 7.2884 4.66667 8.57153L4.68783 9.53344C4.68793 9.53819 4.68861 9.54334 4.68864 9.54809L3.85531 9.55216H3.83171L4.68864 9.54809C4.70261 12.1138 5.29152 13.7638 6.09245 14.8085C6.886 15.8436 7.95379 16.3712 9.10677 16.5712C9.7547 16.6836 10.4244 16.6875 11.0721 16.6208C10.7354 16.5643 10.416 16.4956 10.1143 16.4125C8.73263 16.0318 7.64901 15.345 7.03564 14.2649L7.75911 13.8531H7.75993L7.03564 14.2649C6.87676 13.985 6.89328 13.6381 7.07796 13.3746C7.26264 13.1114 7.58207 12.9783 7.89909 13.032C8.75456 13.1772 9.62178 13.244 10.4894 13.233L10.5236 13.2338H10.5586C10.5848 13.2342 10.6257 13.2353 10.6782 13.2354C10.7833 13.2357 10.9373 13.2339 11.1274 13.2281C11.5096 13.2164 12.032 13.1865 12.5955 13.1134C13.1621 13.0399 13.7509 12.9255 14.2736 12.752C14.7394 12.5974 15.1058 12.4111 15.3584 12.2035L15.4593 12.1132C15.7452 11.8355 15.9439 11.5569 16.0859 11.087C16.2389 10.5805 16.3333 9.82802 16.3333 8.59187ZM15.1875 15.0844C15.5315 15.0607 15.8549 15.2512 16.0005 15.5637C16.146 15.8764 16.0839 16.2467 15.8442 16.4947L15.2453 15.9153L15.1875 15.0844ZM13 10.8331V6.89835C13 6.2049 12.5285 5.83308 12.1667 5.83308C11.8048 5.83308 11.3333 6.2049 11.3333 6.89835V9.3365C11.3333 9.79674 10.9602 10.1698 10.5 10.1698C10.0398 10.1698 9.66667 9.79674 9.66667 9.3365V6.89835L9.66097 6.77221C9.60794 6.15984 9.17264 5.83308 8.83333 5.83308C8.47146 5.83308 8 6.2049 8 6.89835V10.8331C8 11.2933 7.6269 11.6664 7.16667 11.6664C6.70643 11.6664 6.33333 11.2933 6.33333 10.8331V6.89835C6.33333 5.49513 7.35354 4.16642 8.83333 4.16642C9.49937 4.16642 10.0713 4.43666 10.5 4.86059C10.9287 4.43666 11.5006 4.16642 12.1667 4.16642C13.6465 4.16642 14.6667 5.49513 14.6667 6.89835V10.8331C14.6667 11.2933 14.2936 11.6664 13.8333 11.6664C13.3731 11.6664 13 11.2933 13 10.8331ZM18 8.59187C18 9.88503 17.9046 10.8299 17.681 11.5696C17.4464 12.3458 17.0813 12.8622 16.6206 13.3095L16.4237 13.4853C15.9483 13.878 15.3658 14.1458 14.7985 14.3341C14.1406 14.5524 13.4388 14.6846 12.8096 14.7662C12.1774 14.8482 11.598 14.8811 11.1779 14.894C11.0894 14.8967 11.0077 14.896 10.9338 14.8972C12.0127 15.1332 13.4218 15.206 15.1875 15.0844L15.2445 15.9153L15.8442 16.4947C15.2884 17.07 14.2107 17.6046 13.0163 17.9416C11.7891 18.2879 10.2924 18.4684 8.82194 18.2135C7.33741 17.956 5.86428 17.2498 4.77002 15.8225C3.68495 14.4071 3.03928 12.3699 3.02197 9.57088L3 8.60978V8.59106C3 7.35581 3.00128 6.40213 3.1652 5.60196C3.34198 4.73906 3.7004 4.07033 4.33301 3.34773L4.52181 3.15079C4.9821 2.71218 5.56832 2.42096 6.13802 2.22143C6.79884 1.99003 7.51193 1.85612 8.15137 1.77791C8.79429 1.69928 9.38718 1.67415 9.81803 1.66804C10.0342 1.66499 10.2118 1.66704 10.3364 1.66967C10.3988 1.67099 10.4483 1.6725 10.4829 1.67374C10.4891 1.67396 10.4948 1.67435 10.5 1.67455C10.5052 1.67435 10.5109 1.67396 10.5171 1.67374C10.5517 1.67251 10.6012 1.67098 10.6636 1.66967C10.7882 1.66706 10.9657 1.66494 11.182 1.66804C11.6129 1.67423 12.2063 1.69994 12.8494 1.77872C13.4889 1.85707 14.202 1.99072 14.8628 2.22224C15.5136 2.45031 16.1853 2.79809 16.667 3.34854L16.8916 3.6171C17.3865 4.24106 17.6801 4.84766 17.8348 5.60278C17.9987 6.40294 18 7.35663 18 8.59187Z"
        fill="currentColor"
      />
    </svg>
    """
  end

  defp bluesky_logo(assigns) do
    ~H"""
    <svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path
        d="M17.9999 4.97537C17.9999 4.46983 17.8836 4.29102 17.842 4.24458C17.8171 4.21674 17.7575 4.16355 17.5564 4.16645C17.085 4.17331 16.3547 4.4944 15.7099 4.96154L15.3811 5.21382C14.6087 5.83843 13.8005 6.70725 13.0789 7.61616C12.2559 8.65263 11.5894 9.68603 11.2454 10.3733L11.1851 10.4734C11.031 10.6966 10.776 10.8331 10.4999 10.8331C10.2238 10.8331 9.96883 10.6966 9.8147 10.4734L9.75447 10.3733L9.61125 10.0999C9.24189 9.42753 8.64112 8.52319 7.92098 7.61616C7.19932 6.70725 6.39109 5.83843 5.61873 5.21382L5.28996 4.96154C4.64569 4.4945 3.91493 4.17331 3.44344 4.16645C3.2425 4.1636 3.18277 4.21669 3.1578 4.24458C3.11627 4.29098 2.99992 4.4698 2.99992 4.97537C3.00001 5.17625 3.06803 6.16522 3.16349 7.22147C3.2103 7.7393 3.26225 8.25604 3.31242 8.67654C3.33753 8.88697 3.36175 9.06878 3.38403 9.21203C3.39518 9.28364 3.40527 9.34241 3.41414 9.38781C3.41852 9.41019 3.42252 9.42761 3.42554 9.4407L3.43042 9.45942V9.46105L2.68335 9.67589L2.36271 9.76948L3.43042 9.46105C3.64612 10.2059 4.0852 10.5827 4.66496 10.7786C5.21794 10.9654 5.92137 10.9901 6.69539 10.8933L7.03149 10.8445C7.48555 10.7699 7.91379 11.0773 7.98852 11.5314C8.06323 11.9855 7.75576 12.4144 7.30168 12.4892L7.01685 12.5413C5.64539 12.8201 5.04468 13.3579 4.85946 13.7775C4.68781 14.1666 4.73824 14.7975 5.53003 15.5825L5.823 15.8608C6.10491 16.1173 6.35498 16.3095 6.57495 16.4435C6.87203 16.6244 7.06127 16.6665 7.16658 16.6665C7.58941 16.6665 8.02576 16.3693 8.46541 15.7745C8.89197 15.1974 9.15808 14.5694 9.33781 14.2104C9.46545 13.9547 9.55164 13.7495 9.60474 13.5903C9.63104 13.5114 9.6476 13.4499 9.65682 13.4039C9.66133 13.3814 9.66358 13.3641 9.66496 13.3518C9.66563 13.3458 9.6664 13.3411 9.66658 13.338C9.66677 13.3349 9.66658 13.3331 9.66658 13.3331C9.66669 12.873 10.0397 12.4998 10.4999 12.4998C10.9315 12.4998 11.2867 12.8281 11.3292 13.2485L11.3333 13.3331V13.338C11.3334 13.3411 11.3342 13.3458 11.3349 13.3518C11.3363 13.3641 11.3385 13.3814 11.343 13.4039C11.3522 13.4499 11.3688 13.5114 11.3951 13.5903C11.4482 13.7495 11.5344 13.9547 11.662 14.2104L11.8142 14.5253C11.9849 14.8805 12.2146 15.3418 12.5344 15.7745C12.9741 16.3693 13.4104 16.6665 13.8333 16.6665C13.9388 16.6665 14.1281 16.6249 14.4249 16.4443C14.7182 16.2657 15.0651 15.9829 15.4698 15.5825C16.2617 14.797 16.3121 14.1658 16.1404 13.7766C15.9428 13.3292 15.2725 12.7476 13.6982 12.4892L13.6152 12.4713C13.2072 12.3613 12.9414 11.9573 13.0113 11.5314C13.0814 11.1057 13.4622 10.8087 13.8837 10.8347L13.9683 10.8445L14.3044 10.8933C15.0786 10.9898 15.782 10.9653 16.3349 10.7786C16.9146 10.5828 17.3534 10.2054 17.5694 9.46024V9.45942L17.5743 9.4407C17.5773 9.42761 17.5813 9.41019 17.5857 9.38781C17.5946 9.34241 17.6047 9.28365 17.6158 9.21203C17.6381 9.06876 17.6623 8.88701 17.6874 8.67654C17.7376 8.25596 17.7895 7.73939 17.8363 7.22147C17.9318 6.16498 17.9998 5.17586 17.9999 4.97537ZM19.6666 4.97537C19.6665 5.26715 19.5888 6.34043 19.4957 7.37121C19.4481 7.89745 19.3947 8.43178 19.3419 8.8743C19.2929 9.28482 19.2362 9.69773 19.1702 9.92492C18.8196 11.1339 18.0524 11.8805 17.1023 12.2687C17.3394 12.5175 17.5296 12.7959 17.6654 13.1036C18.2248 14.3711 17.7013 15.7167 16.6425 16.7666L16.6417 16.7674C16.1881 17.216 15.7378 17.596 15.2916 17.8676C14.8488 18.1371 14.356 18.3331 13.8333 18.3331C12.5895 18.3331 11.7199 17.477 11.1941 16.7657C10.9095 16.3808 10.6762 15.9667 10.4999 15.6256C10.3237 15.9667 10.0903 16.3808 9.80574 16.7657C9.27997 17.477 8.41033 18.3331 7.16658 18.3331C6.64365 18.3331 6.1507 18.137 5.70825 17.8676C5.26213 17.5959 4.81158 17.2155 4.35815 16.7674L4.35734 16.7666C3.29841 15.717 2.7748 14.3712 3.33439 13.1036C3.47016 12.7962 3.65993 12.5181 3.89673 12.2695C2.94669 11.8812 2.17985 11.1338 1.82967 9.92492L1.78166 9.72309C1.73544 9.49184 1.69472 9.18237 1.65796 8.8743C1.60517 8.43189 1.55171 7.89816 1.50415 7.37202C1.41098 6.34123 1.33332 5.2676 1.33325 4.97537C1.33325 4.2507 1.49626 3.60248 1.91675 3.13292C2.35367 2.6451 2.93839 2.49213 3.46785 2.49979C4.45803 2.51418 5.53408 3.08012 6.26815 3.61225L6.46346 3.75792C7.44043 4.50719 8.41056 5.553 9.2255 6.57938C9.70061 7.17776 10.1356 7.78693 10.4999 8.3494C10.8642 7.78693 11.2992 7.17776 11.7743 6.57938C12.6436 5.48463 13.6894 4.36779 14.7317 3.61225V3.61144L15.0222 3.41206C15.7336 2.94723 16.6656 2.51241 17.532 2.49979C18.0615 2.49209 18.647 2.64488 19.0839 3.13292C19.5042 3.60248 19.6666 4.25084 19.6666 4.97537Z"
        fill="currentColor"
      />
    </svg>
    """
  end

  defp linkedin_logo(assigns) do
    ~H"""
    <svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path
        d="M16.3333 5C16.3333 4.77899 16.2455 4.56709 16.0892 4.41081C15.9329 4.25453 15.721 4.16667 15.5 4.16667H5.5C5.27899 4.16667 5.06709 4.25453 4.91081 4.41081C4.75453 4.56709 4.66667 4.77899 4.66667 5V15C4.66667 15.221 4.75453 15.4329 4.91081 15.5892C5.06709 15.7455 5.27899 15.8333 5.5 15.8333H15.5C15.721 15.8333 15.9329 15.7455 16.0892 15.5892C16.2455 15.4329 16.3333 15.221 16.3333 15V5ZM6.33333 13.3333V9.16667C6.33333 8.70643 6.70643 8.33333 7.16667 8.33333C7.6269 8.33333 8 8.70643 8 9.16667V13.3333C8 13.7936 7.6269 14.1667 7.16667 14.1667C6.70643 14.1667 6.33333 13.7936 6.33333 13.3333ZM13 13.3333V10.8333C13 10.6123 12.9121 10.4004 12.7559 10.2441C12.5996 10.0879 12.3877 10 12.1667 10C11.9457 10 11.7338 10.0879 11.5775 10.2441C11.4212 10.4004 11.3333 10.6123 11.3333 10.8333V13.3333C11.3333 13.7936 10.9602 14.1667 10.5 14.1667C10.0398 14.1667 9.66667 13.7936 9.66667 13.3333V9.16667C9.66667 8.70643 10.0398 8.33333 10.5 8.33333C10.7309 8.33333 10.9399 8.42734 11.0908 8.5791C11.424 8.42011 11.7905 8.33333 12.1667 8.33333C12.8297 8.33333 13.4654 8.59691 13.9342 9.06575C14.4031 9.5346 14.6667 10.1703 14.6667 10.8333V13.3333C14.6667 13.7936 14.2936 14.1667 13.8333 14.1667C13.3731 14.1667 13 13.7936 13 13.3333ZM6.33333 6.6748V6.66667C6.33333 6.20643 6.70643 5.83333 7.16667 5.83333C7.6269 5.83333 8 6.20643 8 6.66667V6.6748C8 7.13504 7.6269 7.50814 7.16667 7.50814C6.70643 7.50814 6.33333 7.13504 6.33333 6.6748ZM18 15C18 15.663 17.7364 16.2987 17.2676 16.7676C16.7987 17.2364 16.163 17.5 15.5 17.5H5.5C4.83696 17.5 4.20126 17.2364 3.73242 16.7676C3.26358 16.2987 3 15.663 3 15V5C3 4.33696 3.26358 3.70126 3.73242 3.23242C4.20126 2.76358 4.83696 2.5 5.5 2.5H15.5C16.163 2.5 16.7987 2.76358 17.2676 3.23242C17.7364 3.70126 18 4.33696 18 5V15Z"
        fill="currentColor"
      />
    </svg>
    """
  end

  attr(:quote, :string, required: true)
  attr(:name, :string, required: true)
  attr(:role, :string, required: true)
  attr(:avatar_src, :string, required: true)
  attr(:rest, :global)
  slot(:logo, required: false)

  defp home_testimonial_card(assigns) do
    ~H"""
    <div data-part="testimonial" {@rest}>
      <%= if @logo != [] do %>
        <div data-part="logo">
          {render_slot(@logo)}
        </div>
      <% end %>
      <div data-part="main">
        <p data-part="quote">
          "{@quote}"
        </p>
        <div data-part="person">
          <img data-part="avatar" src={@avatar_src} />
          <div data-part="details">
            <h3 data-part="name">{@name}</h3>
            <p data-part="role">{@role}</p>
          </div>
        </div>
      </div>
    </div>
    """
  end
end
